@extends('base.base')
@section('base')
    <!-- 内容区域 -->
    <div class="main-panel">
        <div class="content-wrapper">
            <div class="row">
                <div class="col-12 grid-margin stretch-card">
                    <div class="card">
                        <div class="card-body">
                            <h4 class="card-title">请填写渠道信息</h4>
                            {{--<p class="card-description">--}}
                            {{--Basic form elements--}}
                            {{--</p>--}}
                            <form class="forms-sample" id="form">
                                <input type="hidden" name="app_id" value="{{$appId}}">
                                <div class="form-group">
                                    <label >* 渠道名称</label>
                                    <input type="text"  class="form-control required" name="name" placeholder="应用名称">
                                </div>
{{--                                <div class="form-group">--}}
{{--                                    <label >* 所属用户</label>--}}
{{--                                    <input type="text"  class="form-control required" name="user_id" placeholder="user_id">--}}
{{--                                </div>--}}
                                <div class="form-group">
                                    <label >* 注册页链接 <span style="color: red"><b>（禁止非法传播非法用途,如果发现,则会下架）</b></span></label>
                                    <input type="text"  class="form-control required" name="register_url" placeholder="register_url">
                                </div>
{{--                                <div class="form-group">--}}
{{--                                    <label >短链接名称</label>--}}
{{--                                    <input type="text"  class="form-control required" name="short_url_word" placeholder="short_url_word" value="">--}}
{{--                                </div>--}}
                                <div class="form-group">
                                    <div class="form-check">
                                        <label class="form-check-label">
                                            <input type="checkbox" name="weixin_flag" class="form-check-input td-check" value="1">允许微信/QQ流量
                                        </label>
                                    </div>
                                    <div class="form-check">
                                        <label class="form-check-label">
                                            <input type="checkbox" name="brown_flag" class="form-check-input td-check" value="1">允许浏览器流量
                                        </label>
                                        <span style="color: red"><b>（短信渠道要勾选；贷超有网页端要勾选；不确定可以先勾选）</b></span>
                                    </div>
{{--                                    <div class="form-check">--}}
{{--                                        <label class="form-check-label">--}}
{{--                                            <input type="checkbox" name="share_flag" class="form-check-input td-check" value="1">允许分享--}}
{{--                                        </label>--}}
{{--                                    </div>--}}
                                </div>
                                <button type="button" onclick="commit()" class="btn btn-sm btn-gradient-primary btn-icon-text">
                                    <i class="mdi mdi-file-check btn-icon-prepend"></i>
                                    提交
                                </button>
                                <button type="button" onclick="cancel()" class="btn btn-sm btn-gradient-warning btn-icon-text">
                                    <i class="mdi mdi-reload btn-icon-prepend"></i>
                                    取消
                                </button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        function commit(){
            if(!checkForm()){
                return false;
            }
            var data = $("#form").serializeObject();
            myRequest("/admin/channel/add","post",data,function(res){
                layer.msg(res.msg)
                setTimeout(function(){
                    parent.location.reload();
                },1500)
            });
        }
        function cancel() {
            parent.location.reload();
        }
    </script>
@endsection
